package com.orhon.smartcampus.modules.student.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import com.orhon.smartcampus.modules.base.entity.Grades;
import com.orhon.smartcampus.modules.base.entity.Schools;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "student_eclass", schema = "smartcloud", catalog = "")
public class Eclass {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Long id;
    
    @Column(name = "eclass_code", nullable = true, length = 50)
    private String eclassCode;
    
    @Column(name = "class_status", nullable = true)
    private Integer classStatus;
    
    @Column(name = "class_kind_dict", nullable = true)
    private String classKindDict;
    
    @Column(name = "class_nature", nullable = true)
    private String classNature;
    
//    @Column(name = "classroom", nullable = true)
//    private Long classroom;
    
    @Column(name = "graduated_flag", nullable = true)
    private Integer graduatedFlag;
    
    @Column(name = "eclass_order", nullable = true)
    private Integer eclassOrder;
    
    @Column(name = "eclass_number", nullable = true, length = 50)
    private String eclassNumber;
    
    @Column(name = "ioc_path", nullable = true, length = 255)
    private String iocPath;
    
    @Column(name = "eclass_pic", nullable = true, length = 255)
    private String eclassPic;
    
    @Column(name = "created_at", nullable = true)
    private Date createdAt;
    
    @Column(name = "created_by", nullable = true)
    private Integer createdBy;
    
    @Column(name = "updated_at", nullable = true)
    private Date updatedAt;
    
    @Column(name = "updated_by", nullable = true)
    private Integer updatedBy;
    
    @Column(name = "deleted_at", nullable = true)
    private Date deletedAt;
    
    @Column(name = "logo", nullable = true, length = 255)
    private String logo;
    
    @Column(name = "eclass_name", nullable = true)
    private String eclassName;
    
    @Column(name = "introduction", nullable = true)
    private String introduction;
    
    @Column(name = "teacher_comment", nullable = true)
    private String teacherComment;
    
    @Column(name = "eclass_slogan", nullable = true)
    private String eclassSlogan;
    
    @Column(name = "eclass_rota", nullable = true)
    private String eclassRota;
    
    @Column(name = "headteacher_message", nullable = true)
    private String headteacherMessage;

    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
    @JoinColumn(name = "grade_id", referencedColumnName = "id")
    @NotFound(action=NotFoundAction.IGNORE)
    @Where(clause = "ISNULL(deleted_at)")
    private Grades baseGradesByGradeId;

    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
    @JoinColumn(name = "arrives_id", referencedColumnName = "id")
    @NotFound(action=NotFoundAction.IGNORE)
    @Where(clause = "ISNULL(deleted_at)")
    private Arrives studentArrivesByArrivesId;

    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
    @JoinColumn(name = "school_id", referencedColumnName = "id")
    @NotFound(action=NotFoundAction.IGNORE)
    @Where(clause = "ISNULL(deleted_at)")
    private Schools baseSchoolsBySchoolId;

    //班级的全部学生
    @OneToMany( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
    @Where(clause = "ISNULL(deleted_at) and status='normal'")
    @JoinColumn(name = "go_eclass")
    @NotFound(action=NotFoundAction.IGNORE)
    private List<EclassRecords> students;

//    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
//    @JoinColumn(name = "buildings_id", referencedColumnName = "id")
//    @NotFound(action=NotFoundAction.IGNORE)
//    @Where(clause = "ISNULL(deleted_at)")
//    private Buildings materialBuildingsByBuildingsId;

//    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
//    @JoinColumn(name = "unit_id", referencedColumnName = "id")
//    @NotFound(action=NotFoundAction.IGNORE)
//    @Where(clause = "ISNULL(deleted_at)")
//    private Unit materialUnitByUnitId;

//    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
//    @JoinColumn(name = "floor_id", referencedColumnName = "id")
//    @NotFound(action=NotFoundAction.IGNORE)
//    @Where(clause = "ISNULL(deleted_at)")
//    private Floor materialFloorByFloorId;
    
//    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
//    @JoinColumn(name = "classroom", referencedColumnName = "id")
//    @NotFound(action=NotFoundAction.IGNORE)
//    @Where(clause = "ISNULL(deleted_at)")
//    private Room room;




}
